/**
 * @file
 * @author dousha 
 * @date 2020/11/29.
 */

#ifndef CRYPTSTICK_FLASH_H
#define CRYPTSTICK_FLASH_H

#include <stdint.h>

#define FLASH_MAGIC_ADDR 0x0800c000u
#define FLASH_SALT_ADDR 0x0800c020u
#define FLASH_SETUP_INFO 0x0800c040u

#define SETUP_MAGIC 0xf00dbabeu

extern void flash_init();

extern void flash_read_magic(uint32_t *);

extern void flash_write_magic(const uint32_t *);

extern void flash_read_salt(uint32_t *);

extern void flash_write_salt(const uint32_t *);

extern void flash_reset_setup();

extern uint8_t flash_has_setup();

extern void flash_finish_setup();

#endif //CRYPTSTICK_FLASH_H
